package org.cfx;

import org.cfx.auth.interceptor.LoginInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@MapperScan("org.cfx.*.mapper")
//@ServletComponentScan("org.cfx.auth.listener") // 扫描监听器
@EnableCaching      // 开启spring缓存
public class CarStart implements WebMvcConfigurer {
    public static void main(String[] args) {
        SpringApplication.run(CarStart.class,args);
    }
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**","/user/register","/shop/settlement","/shop/active/**")
                .excludePathPatterns("/user/bind/**","/swagger-ui/**")
                .excludePathPatterns("/login","/login2","/employee/exportExcel","/employee/importExcel","/logout","/employee/exportMore","employee/exportMoreExcel")
                .excludePathPatterns("/verifyCode/**","/fastdfs/**");
    }
}
